// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#pragma once

#include "fastflow/core/common.h"
#include "fastflow/core/exceptions.h"

// Setup the infrastructure to throw ORT exceptions so they're caught by existing handlers.

template <typename E>
class SafeIntExceptionHandler;

template <>
class SafeIntExceptionHandler<fastflow::FastFlowException> {
 public:
  static void SafeIntOnOverflow() {
    FASTFLOW_THROW("Integer overflow");
  }

  static void SafeIntOnDivZero() {
    FASTFLOW_THROW("Divide by zero");
  }
};

#define SAFEINT_EXCEPTION_HANDLER_CPP 1
#define SafeIntDefaultExceptionHandler SafeIntExceptionHandler<fastflow::FastFlowException>
#include "fastflow/core/SafeInt.hpp"
